<script setup>
import { defineProps } from 'vue';
import router from "@/router/index.js";

// 定义props，允许从外部传递titleText
const props = defineProps({
  titleText: {
    type: String,
    required: false,
    default: '标题' // 设置默认值
  }
});
</script>

<template>
  <div id="title">
    <div class="card-title">
      <div class="back-btn">
        <a-button size="mini" @click="router.back"><IconLeft></IconLeft>返回</a-button>
      </div>
      <!-- 使用props中的titleText作为标题 -->
      <div class="title">{{ props.titleText }}</div>
    </div>
  </div>
</template>

<style scoped>
.card-title {
  display: flex;
  align-items: center;
  height: 30px;
  margin-bottom: 10px;
}

.card-title .title {
  margin: 0 5px;
  font-size: 24px;
  font-weight: 500;
  color: var(--color-text-1);
}
</style>
